<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>表格的增删改查</title>
    <style>
        table {
            width: 100%;
            border-collapse: collapse;
            /* 合并单元格 */
            margin-top: 20px;
        }

        th,
        td {
            border: 1px solid #dddddd;
            text-align: center;
            padding: 8px;
        }

        th {
            background-color: #f2f2f2;
        }

        button {
            margin-left: 5px;
        }
    </style>
</head>

<body>
    <h1 style="text-align:center">表格的增删改查</h1>
    <button onclick="addRow()">新增数据</button>
    <table id="dataTable">
        <tr>
            <th>姓名</th>
            <th>联系方式</th>
            <th>操作</th>
        </tr>
        <tr>
            <td>张三</td>
            <td>12345678910</td>
            <td>
                <button onclick="editRow(this)">编辑</button><button onclick="deleteRow(this)">删除</button>
                <!-- this在JS中是一个关键字，指向当前的上下文对象 -->
            </td>
        </tr>
    </table>
    <script src="./js/table.js"></script>
</body>

</html>